package com.distribute.framework.model;

import com.distribute.framework.core.web.helper.Utils;
import java.lang.reflect.Field;
import java.util.Date; 
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

import javax.annotation.Resource;

import com.distribute.framework.core.web.util.Page;
import com.distribute.framework.core.lang.*; 
import com.distribute.framework.core.web.helper.WebHelper.LzMap;
import com.distribute.framework.core.util.Function;
import com.distribute.framework.core.util.IbatisMap;
import com.distribute.framework.config.*;
import com.distribute.framework.plugin.*;

@namespace("agents/agencycardorder")
public @caption("代理卡订单") @database(DatabaseNames.distribute_sys) @source("distribute_sys") @table("agent_card_order") class AgentCardOrder implements java.io.Serializable
{
	private static final long serialVersionUID = 1l;
		
	
		
	private @caption("编号") @column("id")    @primary  @notnull  @note("  ") Long id;// 主键 非空     
			
 			
 			
 		
	
		
	private @caption("订单编号") @column("order_number")      @note("  ") String orderNumber;//     
			
 			
 			
 		
	
		
	private @caption("所属品牌") @column("merchant")     @notnull  @relate("$merchant") @RelateClass(Merchant.class)  @note("  ") Long merchant;// 非空     
			
 	private transient Merchant $merchant;//关联对象[品牌信息]
 			
 			
 			
 		
	
		
	private @caption("用户编号") @column("uid") @like     @note("  ") String uid;//     
			
 			
 			
 		
	
		
	private transient @caption("用户名称") @column("nick_name") @like     @note("  ") String nickName;//     
			
 			
 			
 		
	
		
	private @caption("用户") @column("member")   @hidden   @notnull  @relate("$member") @RelateClass(Member.class)  @note("  ") Long member;// 非空     
			
 	private transient Member $member;//关联对象[会员信息]
 			
 			
 			
 		
	
		
	private @caption("代理卡") @column("agent_card")      @relate("$agentCard") @RelateClass(AgentConf.class)  @note("  ") Long agentCard;//     
			
 	private transient AgentConf $agentCard;//关联对象[代理卡配置]
 			
 			
 			
 		
	
		
	private @caption("formId") @column("formid")      @note("  ") String formid;//     
			
 			
 			
 		
	
		
	private @caption("支付金额") @column("pay_money")     @notnull  @note("  ") Double payMoney;// 非空     
			
 			
 			
 		
	
		
	private @caption("支付时间") @column("pay_time")     @notnull  @note("  ") Date payTime;// 非空     
			
 			
 			
 		
	
		
	private @caption("支付状态") @column("pay_status")     @notnull  @note(" 1:未支付 2:已支付  ") Short payStatus;// 非空 1:未支付 2:已支付     
			
 			
 			
 		
	
		
	private @caption("修改时间") @column("update_time")     @notnull  @note("  ") Date updateTime;// 非空     
			
 			
 			
 		
	
		
	private @caption("添加时间") @column("add_time")     @notnull  @note("  ") Date addTime;// 非空     
			
 			
 			
 		
	
		
	private @caption("状态") @column("status")     @notnull  @note(" 1:正常 0:无效  ") Short status;// 非空 1:正常 0:无效     
			
 			
 			
 		
	
	 
	//默认构造函数
	public AgentCardOrder(){ 
	
	}
	
	//主键构造函数
	public AgentCardOrder(Long id){
		this.id = id;
	}
	
	/**所有字段构造函数 
	 AgentCardOrder(
	 	Utils.getString("number")//订单编号
	 	,Utils.getLong("")//所属品牌 [非空]
	 	,Utils.getString("")//用户编号
	 	,Utils.getLong("")//用户 [非空]
	 	,Utils.getLong("card")//代理卡
	 	,Utils.getString("")//formId
	 	,Utils.getDouble("money")//支付金额 [非空]
	 	,Utils.getDate("time")//支付时间 [非空]
	 	,Utils.getShort("status")//支付状态 [非空]
	 	,Utils.getDate("time")//修改时间 [非空]
	 	,Utils.getDate("time")//添加时间 [非空]
	 	,Utils.getShort("")//状态 [非空]
	 )
	**/
	public AgentCardOrder(String orderNumber,Long merchant,String uid,Long member,Long agentCard,String formid,Double payMoney,Date payTime,Short payStatus,Date updateTime,Date addTime,Short status){
		
			
			
		this.orderNumber=orderNumber;
		
			
		this.merchant=merchant;
		
			
		this.uid=uid;
		
			
			
		this.member=member;
		
			
		this.agentCard=agentCard;
		
			
		this.formid=formid;
		
			
		this.payMoney=payMoney;
		
			
		this.payTime=payTime;
		
			
		this.payStatus=payStatus;
		
			
		this.updateTime=updateTime;
		
			
		this.addTime=addTime;
		
			
		this.status=status;
		
	}
	
	//设置非空字段
	public AgentCardOrder setNotNull(Long merchant,Long member,Double payMoney,Date payTime,Short payStatus,Date updateTime,Date addTime,Short status){
		
			
			
			
		this.merchant=merchant;
		
			
			
			
		this.member=member;
		
			
			
			
		this.payMoney=payMoney;
		
			
		this.payTime=payTime;
		
			
		this.payStatus=payStatus;
		
			
		this.updateTime=updateTime;
		
			
		this.addTime=addTime;
		
			
		this.status=status;
		
		return this;
	}
	
	
		
	/** 编号 [非空]       **/
	public AgentCardOrder id(Long id){
		this.id = id;
		this.setSeted(F.id);
		return this;
	}
	
		
	/** 订单编号        **/
	public AgentCardOrder orderNumber(String orderNumber){
		this.orderNumber = orderNumber;
		this.setSeted(F.orderNumber);
		return this;
	}
	
		
	/** 所属品牌 [非空] [Merchant]      **/
	public AgentCardOrder merchant(Long merchant){
		this.merchant = merchant;
		this.setSeted(F.merchant);
		return this;
	}
	
		
	/** 用户编号        **/
	public AgentCardOrder uid(String uid){
		this.uid = uid;
		this.setSeted(F.uid);
		return this;
	}
	
		
		
	/** 用户 [非空] [Member]      **/
	public AgentCardOrder member(Long member){
		this.member = member;
		this.setSeted(F.member);
		return this;
	}
	
		
	/** 代理卡  [AgentConf]      **/
	public AgentCardOrder agentCard(Long agentCard){
		this.agentCard = agentCard;
		this.setSeted(F.agentCard);
		return this;
	}
	
		
	/** formId        **/
	public AgentCardOrder formid(String formid){
		this.formid = formid;
		this.setSeted(F.formid);
		return this;
	}
	
		
	/** 支付金额 [非空]       **/
	public AgentCardOrder payMoney(Double payMoney){
		this.payMoney = payMoney;
		this.setSeted(F.payMoney);
		return this;
	}
	
		
	/** 支付时间 [非空]       **/
	public AgentCardOrder payTime(Date payTime){
		this.payTime = payTime;
		this.setSeted(F.payTime);
		return this;
	}
	
		
	/** 支付状态 [非空]   1:未支付 2:已支付     **/
	public AgentCardOrder payStatus(Short payStatus){
		this.payStatus = payStatus;
		this.setSeted(F.payStatus);
		return this;
	}
	
		
	/** 修改时间 [非空]       **/
	public AgentCardOrder updateTime(Date updateTime){
		this.updateTime = updateTime;
		this.setSeted(F.updateTime);
		return this;
	}
	
		
	/** 添加时间 [非空]       **/
	public AgentCardOrder addTime(Date addTime){
		this.addTime = addTime;
		this.setSeted(F.addTime);
		return this;
	}
	
		
	/** 状态 [非空]   1:正常 0:无效     **/
	public AgentCardOrder status(Short status){
		this.status = status;
		this.setSeted(F.status);
		return this;
	}
	
	
	
	/**
	* 克隆对象
	**/
	public AgentCardOrder clone(){
		AgentCardOrder clone = new AgentCardOrder();
		
			
			
		clone.orderNumber=this.orderNumber;
		
			
		clone.merchant=this.merchant;
		
			
		clone.uid=this.uid;
		
			
			
		clone.member=this.member;
		
			
		clone.agentCard=this.agentCard;
		
			
		clone.formid=this.formid;
		
			
		clone.payMoney=this.payMoney;
		
			
		clone.payTime=this.payTime;
		
			
		clone.payStatus=this.payStatus;
		
			
		clone.updateTime=this.updateTime;
		
			
		clone.addTime=this.addTime;
		
			
		clone.status=this.status;
		
		return clone;
	}
	
	
	
	
	
	/**
	 * 根据ID取代理卡订单
	 * @param id
	 * @return
	 */
	public static @api AgentCardOrder get(Long id){		
		return getAgentCardOrderById(id);
	}
	
	
	
	/**
	 * 获取所有代理卡订单
	 * @return
	 */
	public static @api List<AgentCardOrder> list(Map params,Integer size){
		return getAgentCardOrderList(params,size);
	}
	/**
	 * 获取代理卡订单分页
	 * @return
	 */
	public static @api Page<AgentCardOrder> page(Integer page,Integer size,Map params){
		return getAgentCardOrderPage(page, size , params);
	}
	
	
	/**
	 * 根据查询条件取代理卡订单
	 * @param params
	 * @return
	 */
	public static @api AgentCardOrder Get(Map params){
		return getAgentCardOrder(params);
	}
	/**
	 * 获取代理卡订单数
	 * @return
	 */
	public static @api Long count(Map params){
		return getAgentCardOrderCount(params);
	}
	/**
	 * 获取代理卡订单数
	 * @return
	 */
	public static @api <T> T eval(String eval,Map params){
		return getAgentCardOrderEval(eval,params);
	}
	
	
	/**
	 * 获取代理卡订单图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey){
		return getAgentCardOrderStats(params,sumKey,groupKey,-1);
	}
	/**
	 * 获取代理卡订单图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> stats(Map params,C sumKey,C groupKey,int dateType){
		return getAgentCardOrderStats(params,sumKey,groupKey,dateType);
	}
	
	
	/**
	 * 根据ID取代理卡订单
	 * @param id
	 * @return
	 */
	public static @api AgentCardOrder getAgentCardOrderById(Long id){		
		return getAgentCardOrderDao().getAgentCardOrderById(id);
	}
	
	
	
	
	/**
	 * 根据ID取代理卡订单的标识键值
	 * @param id
	 * @return
	 */
	public static @api String getKeyValue(Object key){
		Long id = Utils.parseLong(key);	
		if(id==null || id.longValue()==0 ){
			
			return null;
			
		}
		String value = null;
				
		if(value==null){
			AgentCardOrder agentCardOrder = get(id);
			if(agentCardOrder!=null){
				String strValue = agentCardOrder.getOrderNumber$();
				
				if(!"OrderNumber".equals("OrderNumber"))
					strValue+="("+agentCardOrder.getOrderNumber$()+")";
				
				if(!"OrderNumber".equals("AgentCard"))
					strValue+="("+agentCardOrder.getAgentCard$()+")";
				
				
				value = strValue;
			}else{
				
				value = "{"+id+"}";
			}
		}
		
		/************LAZY3Q_ID_KEYVALUE************/
		/************LAZY3Q_ID_KEYVALUE************/
		return value;
	}	
	
	
	/**
	 * 获取当前对象的键值
	 * @return
	 */
	public String getKeyValue(){
		
		/************LAZY3Q_CODE_KEYVALUE************/
		/************LAZY3Q_CODE_KEYVALUE************/
		String keyValue = this.getOrderNumber$();
		
		if(!"OrderNumber".equals("OrderNumber"))
			keyValue+="("+this.getOrderNumber$()+")";
		
		if(!"OrderNumber".equals("AgentCard"))
			keyValue+="("+this.getAgentCard$()+")";
		
		return keyValue;
	}
	
	
	/**
	 * 根据关键字精确查询代理卡订单对象
	 * @return
	 */
	public static @api AgentCardOrder find(String key){
		if(Utils.empty(key))return null;
		Map params = new HashMap();
		if(key.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
			params.put("id", key.toLowerCase().replaceFirst("id:", ""));					
		else{//按标识查询，精确查询
			String strDefinex = "";
			
			strDefinex+=" or order_number = '"+key.replaceAll("'", "''")+"'";
			
			strDefinex+=" or agent_card = '"+key.replaceAll("'", "''")+"'";
			
			strDefinex="(2=1 "+strDefinex+")";
			params.put("definex",strDefinex);
		}
		
		/************LAZY3Q_CODE_FIND************/
		/************LAZY3Q_CODE_FIND************/
		return AgentCardOrder.getAgentCardOrder(params);
	}
	
	
	/**
	 * 根据关键字查询代理卡订单
	 * @return
	 */
	public static @api List<Map> query(String key,int size,Map params,Boolean bObject){
		if(Utils.empty((String)params.get("asc")) && Utils.empty((String)params.get("desc")))//如果未传入排序字段
			params.put("desc","id");//那么，默认以主键降序，传给Dao层
		String strTerm=key;		
		if(!Utils.empty(strTerm)){
			if(strTerm.toLowerCase().startsWith("id:"))//如果查询条件以id:开头，则按ID查询
				params.put("id", strTerm.toLowerCase().replaceFirst("id:", ""));					
			else//按标识查询，模糊查询请带%
			{
				String strDefinex = "";
				
				strDefinex+=" or order_number like '%"+strTerm.replaceAll("'", "''")+"%'";
				
				strDefinex+=" or agent_card like '%"+strTerm.replaceAll("'", "''")+"%'";
				
				strDefinex="(2=1 "+strDefinex+")";
				params.put("definex",strDefinex);
			}
		}
		
		
		/************LAZY3Q_CODE_QUERY************/
		/************LAZY3Q_CODE_QUERY************/
			
		List<AgentCardOrder> list = page(0,size,params).getResult();
		
		/**
		* OK!取到数据拼成放入Map中，[{value,text,object:{...}},...]
		* value:数据ID，text:数据标识,object,整个对象
		**/
		List<Map> result = new java.util.ArrayList();
		for(AgentCardOrder agentCardOrder:list){
			Map map = new HashMap();
			map.put("key",agentCardOrder.getId().toString());
			map.put("value", Utils.js(agentCardOrder.getKeyValue()));
			if(bObject==true)
				map.put("object",agentCardOrder);
			result.add(map);
		}
		
		
		/************LAZY3Q_AFTER_QUERY************/
		/************LAZY3Q_AFTER_QUERY************/
		
		return result;
	}
	
	
	
	/**
	 * 获取所有代理卡订单
	 * @return
	 */
	public static @api List<AgentCardOrder> getAgentCardOrderList(Map params,Integer size){
		return getAgentCardOrderDao().getAgentCardOrderList(params,0,size);
	}
	
	/**
	 * 获取代理卡订单分页
	 * @return
	 */
	public static @api Page<AgentCardOrder> getAgentCardOrderPage(Integer page,Integer size,Map params){
		if(page==null)page=0;
		if(size==null)size=20;
		return getAgentCardOrderDao().getAgentCardOrderPage(page, size , params);
	}
	
	/**
	 * 根据查询条件取代理卡订单
	 * @param params
	 * @return
	 */
	public static @api AgentCardOrder getAgentCardOrder(Map params){
		return getAgentCardOrderDao().getAgentCardOrder(params);
	}
	
	/**
	 * 保存一个代理卡订单
	 * @param agentCardOrder
	 * @return
	 */
	public static @api AgentCardOrder saveAgentCardOrder(AgentCardOrder agentCardOrder){
		return getAgentCardOrderDao().saveAgentCardOrder(agentCardOrder);
	}
	
	/**
	 * 根据条件更新代理卡订单
	 * @param values
	 * @param params
	 */
	public static @api int updateAgentCardOrderByConfirm(Map values, Map params){
		return getAgentCardOrderDao().updateAgentCardOrderByConfirm(values,params);
	}
	
	/**
	 * 修改一个代理卡订单
	 * @param agentCardOrder
	 * @return
	 */
	public static @api int updateAgentCardOrder(AgentCardOrder agentCardOrder){
		return getAgentCardOrderDao().updateAgentCardOrder(agentCardOrder);
	}
	
	/**
	 * 更新代理卡订单非空字段
	 * @param agentCardOrder
	 */
	public static @api int updateAgentCardOrder$NotNull(AgentCardOrder agentCardOrder){
		return getAgentCardOrderDao().updateAgentCardOrder$NotNull(agentCardOrder);
	}
	
	/**
	 * 获取代理卡订单数
	 * @return
	 */
	public static @api Long getAgentCardOrderCount(Map params){
		return getAgentCardOrderDao().getAgentCardOrderCount(params);
	}
		
		
	/**
	 * 获取代理卡订单自定义求和表达式,比如求和:eval="sum(id)"
	 * @return
	 */	
	public static @api <T> T getAgentCardOrderEval(String eval,Map params){
		return getAgentCardOrderDao().getAgentCardOrderEval(eval,params);
	}
	
	
	/**
	 * 获取代理卡订单图表统计数据
	 * @param params 查询条件
	 * @param sumKey 统计的字段
	 * @param groupKey 分组的字段
	 * @param dateType 1:按年， 2：按月， 3：按周， 4：按日， 5：按小时， 6：月分， 7：日分， 8：点分
	 * @return
	 */
	public static @api List<Map> getAgentCardOrderStats(Map params,C sumKey,C groupKey,int dateType){
		//TODO:图表统计功能未实现
		
		Map<String,Object> groups=new HashMap();//要分组的字段
		Map<String,Object> sums=new HashMap();//要统计的字段
		
		String[][] dateFormats=new String[][]{
				null,
				new String[]{"%Y","yyyy年","Y"},
				new String[]{"%Y-%m","yyyy年MM月","M"},
				new String[]{"%Y%U","yyyy年第ww周","W"},
				new String[]{"%Y-%m-%d","yyyy年MM月dd日","D"},
				new String[]{"%Y-%m-%d %H","yyyy年MM月dd日 HH点","H"},
				new String[]{"%m","MM月"},
				new String[]{"%d","dd号"},
				new String[]{"%H","HH点"} 
		};
		
		//获取要分组的字段，放入Map中
		if(dateType>0){
			groups.put(groupKey.toString(),"DATE_FORMAT({key},'"+dateFormats[dateType][0]+"')");
		}else{
			groups.put(groupKey.toString(),"{key}");
		}
		if(dateType<6 && dateType>0){ 
			params.put("asc", groupKey.toString()); 
			if(params.get(groupKey.name()+"Start")==null){
				params.put(groupKey.name()+"Start", Utils.date(new Date(), -24, dateFormats[dateType][2]));
			}
		}
		
		
		//获取要统计的字段，放入Map中
		if(sumKey.toString().equals("count")){
			sums.put(sumKey.toString(),"count(*)");
		}else{
			sums.put(sumKey.toString(),"sum({key})");
		}
		
		List<Map> list = getAgentCardOrderDao().getAgentCardOrderStats(params,groups,sums);
		
		List<Map> result = new ArrayList();
		for(Map m:list){
			Map map = new HashMap();
			Object value = m.get(sumKey.toString());
			Object name = null;
			Object groupValue = m.get(groupKey.toString());
			if(dateType>0){
				name = Utils.date(Utils.parseDate(groupValue), dateFormats[dateType][1]);
			}else{
				try{
					java.lang.reflect.Method method = AgentCardOrder.class.getMethod("get"+Utils.ForMat(groupKey.toString())+"$");
					method.setAccessible(true);
					name = method.invoke(AgentCardOrder.fromMap(m));
				}catch(Exception ex){
					ex.printStackTrace();
				}
			}
			map.put("name", name);
			map.put("value", value);
			result.add(map);
		}
		return result;
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static int updateAgentCardOrder(Map set,Map where){
		if(set.isEmpty())throw new RuntimeException("set为空");
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		return getAgentCardOrderDao().updateAgentCardOrderByConfirm(set, where);
	}
	
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void deleteAgentCardOrder(Map where){
		if(where.isEmpty())throw new RuntimeException("where为空");
		where.put("confirm", "1");
		getAgentCardOrderDao().deleteAgentCardOrderByConfirm(where);
	}
	
	/**
	 * 根据条件更新数据
	 * @param set
	 * @param where
	 */
	public static void delete(Long id){
		if(id==null)throw new RuntimeException("id为空");
		
		getAgentCardOrderDao().removeAgentCardOrderById(id);
		
	}
	
	
	/**
	 * 保存代理卡订单对象
	 * @param params
	 * @return
	 */
	public AgentCardOrder save(){
		if(this.getId()!=null)
			getAgentCardOrderDao().updateAgentCardOrder(this);
		else
			return getAgentCardOrderDao().saveAgentCardOrder(this);
		return this;
	}
	
	
	/**
	 * 更新代理卡订单对象的非空字段,注意跟Service里面的update不一样哦
	 * @param params
	 * @return
	 */
	public int update(){
		return getAgentCardOrderDao().updateAgentCardOrder$NotNull(this);
	}
	
	
	/**
	 * 删除
	 * @param params
	 * @return
	 */
	public void delete(){
		
		if(Utils.equals(Utils.config("logic_delete"),"true"))
			getAgentCardOrderDao().removeAgentCardOrderById(this.getId());
		else
		
			getAgentCardOrderDao().deleteAgentCardOrderById(this.getId());
	}
	
	/**
	 * 执行事务
	 * @param function
	 */
	public static <T> T execute(Function function){
		return getAgentCardOrderDao().executeTransaction(function);
	}

	
	
	/*******************************编号**********************************/	
	/**
	* 编号 [非空]      
	**/
	public Long getId(){
		
		if(this.id!=null){
			return this.id;
		}
		
		return this.id;
	}
	/**
	* 获取编号格式化(toString)
	**/
	public String getId$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getId());
	 
	 	 return strValue;
	}
	/**
	* 根据编号反格式化
	**/
	public void setId$(String strValue){
		if(Utils.empty(strValue)){
			this.id=null;
			return;
		}
	
	
	 	this.id=Utils.parseLong(strValue);
	 
	}
	
	/**
	* 编号 [非空]      
	**/
	public void setId(Long id){
		this.id = id;
		
		this.setSeted(F.id);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************订单编号**********************************/	
	/**
	* 订单编号       
	**/
	public String getOrderNumber(){
		
		if(this.orderNumber!=null){
			return this.orderNumber;
		}
		
		return this.orderNumber;
	}
	/**
	* 获取订单编号格式化(toString)
	**/
	public String getOrderNumber$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getOrderNumber());
	 
	 	 return strValue;
	}
	/**
	* 根据订单编号反格式化
	**/
	public void setOrderNumber$(String strValue){
		if(Utils.empty(strValue)){
			this.orderNumber=null;
			return;
		}
	
	
	 	this.orderNumber=strValue;
	 
	}
	
	/**
	* 订单编号       
	**/
	public void setOrderNumber(String orderNumber){
		this.orderNumber = orderNumber;
		
		this.setSeted(F.orderNumber);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************所属品牌**********************************/	
	/**
	* 所属品牌 [非空] [Merchant]     
	**/
	public Long getMerchant(){
		
		if(this.merchant!=null){
			return this.merchant;
		}
		
		return this.merchant;
	}
	/**
	* 获取所属品牌格式化(toString)
	**/
	public String getMerchant$(){
		String strValue="";
	
	
		 
		if(this.getMerchant()!=null){
			
				strValue+=Utils.string(Merchant.getKeyValue(this.getMerchant()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据所属品牌反格式化
	**/
	public void setMerchant$(String strValue){
		if(Utils.empty(strValue)){
			this.merchant=null;
			return;
		}
	
	
		 
		Merchant item = Merchant.find(strValue);
		if(item!=null){
			
			this.merchant = Utils.parseLong(item.getId());
			
		}
		 
	 
	}
	
	/**
	* 所属品牌 [非空] [Merchant]     
	**/
	public void setMerchant(Long merchant){
		this.merchant = merchant;
		
		this.setSeted(F.merchant);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[品牌信息]
	**/	 			
 	public Merchant get$merchant(){
 		if(this.$merchant!=null)
 			return this.$merchant;
 		com.distribute.framework.model.Merchant merchant = null;
		if(this.getMerchant()!=null){
		
 			merchant = Merchant.get(this.getMerchant());
 		
 		}
 		return merchant;
	}
	
 	
	
	
	/*******************************用户编号**********************************/	
	/**
	* 用户编号       
	**/
	public String getUid(){
		
		if(this.uid!=null){
			return this.uid;
		}
		
		return this.uid;
	}
	/**
	* 获取用户编号格式化(toString)
	**/
	public String getUid$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getUid());
	 
	 	 return strValue;
	}
	/**
	* 根据用户编号反格式化
	**/
	public void setUid$(String strValue){
		if(Utils.empty(strValue)){
			this.uid=null;
			return;
		}
	
	
	 	this.uid=strValue;
	 
	}
	
	/**
	* 用户编号       
	**/
	public void setUid(String uid){
		this.uid = uid;
		
		this.setSeted(F.uid);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************用户名称**********************************/	
	/**
	* 用户名称       
	**/
	public String getNickName(){
		
		if(this.nickName!=null){
			return this.nickName;
		}
		
		Member member = Member.get(this.getMember());
		if(member!=null){
			this.nickName=member.getNickName();
		}
				
		
		return this.nickName;
	}
	/**
	* 获取用户名称格式化(toString)
	**/
	public String getNickName$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getNickName());
	 
	 	 return strValue;
	}
	/**
	* 根据用户名称反格式化
	**/
	public void setNickName$(String strValue){
		if(Utils.empty(strValue)){
			this.nickName=null;
			return;
		}
	
	
	 	this.nickName=strValue;
	 
	}
	
	/**
	* 用户名称       
	**/
	public void setNickName(String nickName){
		this.nickName = nickName;
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************用户**********************************/	
	/**
	* 用户 [非空] [Member]     
	**/
	public Long getMember(){
		
		if(this.member!=null){
			return this.member;
		}
		
		return this.member;
	}
	/**
	* 获取用户格式化(toString)
	**/
	public String getMember$(){
		String strValue="";
	
	
		 
		if(this.getMember()!=null){
			
				strValue+=Utils.string(Member.getKeyValue(this.getMember()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据用户反格式化
	**/
	public void setMember$(String strValue){
		if(Utils.empty(strValue)){
			this.member=null;
			return;
		}
	
	
		 
		Member item = Member.find(strValue);
		if(item!=null){
			
			this.member = Utils.parseLong(item.getUid());
			
		}
		 
	 
	}
	
	/**
	* 用户 [非空] [Member]     
	**/
	public void setMember(Long member){
		this.member = member;
		
		this.setSeted(F.member);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[会员信息]
	**/	 			
 	public Member get$member(){
 		if(this.$member!=null)
 			return this.$member;
 		com.distribute.framework.model.Member member = null;
		if(this.getMember()!=null){
		
 			member = Member.get(this.getMember());
 		
 		}
 		return member;
	}
	
 	
	
	
	/*******************************代理卡**********************************/	
	/**
	* 代理卡  [AgentConf]     
	**/
	public Long getAgentCard(){
		
		if(this.agentCard!=null){
			return this.agentCard;
		}
		
		return this.agentCard;
	}
	/**
	* 获取代理卡格式化(toString)
	**/
	public String getAgentCard$(){
		String strValue="";
	
	
		 
		if(this.getAgentCard()!=null){
			
				strValue+=Utils.string(AgentConf.getKeyValue(this.getAgentCard()));
			
		}			
		 
	 
	 	 return strValue;
	}
	/**
	* 根据代理卡反格式化
	**/
	public void setAgentCard$(String strValue){
		if(Utils.empty(strValue)){
			this.agentCard=null;
			return;
		}
	
	
		 
		AgentConf item = AgentConf.find(strValue);
		if(item!=null){
			
			this.agentCard = Utils.parseLong(item.getId());
			
		}
		 
	 
	}
	
	/**
	* 代理卡  [AgentConf]     
	**/
	public void setAgentCard(Long agentCard){
		this.agentCard = agentCard;
		
		this.setSeted(F.agentCard);
		
	}
	
	
		 
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 		
	/**
	* 获取关联对象[代理卡配置]
	**/	 			
 	public AgentConf get$agentCard(){
 		if(this.$agentCard!=null)
 			return this.$agentCard;
 		com.distribute.framework.model.AgentConf agentConf = null;
		if(this.getAgentCard()!=null){
		
 			agentConf = AgentConf.get(this.getAgentCard());
 		
 		}
 		return agentConf;
	}
	
 	
	
	
	/*******************************formId**********************************/	
	/**
	* formId       
	**/
	public String getFormid(){
		
		if(this.formid!=null){
			return this.formid;
		}
		
		return this.formid;
	}
	/**
	* 获取formId格式化(toString)
	**/
	public String getFormid$(){
		String strValue="";
	
	
		 strValue=Utils.string(this.getFormid());
	 
	 	 return strValue;
	}
	/**
	* 根据formId反格式化
	**/
	public void setFormid$(String strValue){
		if(Utils.empty(strValue)){
			this.formid=null;
			return;
		}
	
	
	 	this.formid=strValue;
	 
	}
	
	/**
	* formId       
	**/
	public void setFormid(String formid){
		this.formid = formid;
		
		this.setSeted(F.formid);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************支付金额**********************************/	
	/**
	* 支付金额 [非空]      
	**/
	public Double getPayMoney(){
		
		if(this.payMoney!=null){
			return this.payMoney;
		}
		
		return this.payMoney;
	}
	/**
	* 获取支付金额格式化(toString)
	**/
	public String getPayMoney$(){
		String strValue="";
	
	
			
		 strValue=Utils.string(this.getPayMoney());	
			
	 
	 	 return strValue;
	}
	/**
	* 根据支付金额反格式化
	**/
	public void setPayMoney$(String strValue){
		if(Utils.empty(strValue)){
			this.payMoney=null;
			return;
		}
	
	
	 	this.payMoney=Utils.parseDouble(strValue);
	 
	}
	
	/**
	* 支付金额 [非空]      
	**/
	public void setPayMoney(Double payMoney){
		this.payMoney = payMoney;
		
		this.setSeted(F.payMoney);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************支付时间**********************************/	
	/**
	* 支付时间 [非空]      
	**/
	public Date getPayTime(){
		
		if(this.payTime!=null){
			return this.payTime;
		}
		
		return this.payTime;
	}
	/**
	* 获取支付时间格式化(toString)
	**/
	public String getPayTime$(){
		String strValue="";
	
	
	 	
		 strValue=Utils.string(Utils.date(this.getPayTime(),"yyyy-MM-dd HH:mm:ss"));
		
	 
	 	 return strValue;
	}
	/**
	* 根据支付时间反格式化
	**/
	public void setPayTime$(String strValue){
		if(Utils.empty(strValue)){
			this.payTime=null;
			return;
		}
	
	
	 	this.payTime=Utils.date(strValue,"yyyy-MM-dd HH:mm:ss");
	 
	}
	
	/**
	* 支付时间 [非空]      
	**/
	public void setPayTime(Date payTime){
		this.payTime = payTime;
		
		this.setSeted(F.payTime);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************支付状态**********************************/	
	/**
	* 支付状态 [非空]   1:未支付 2:已支付    
	**/
	public Short getPayStatus(){
		
		if(this.payStatus!=null){
			return this.payStatus;
		}
		
		return this.payStatus;
	}
	/**
	* 获取支付状态格式化(toString)
	**/
	public String getPayStatus$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getPayStatus()),"1"))
			strValue=Utils.string("未支付");		 
			
		 if(Utils.equals(Utils.string(this.getPayStatus()),"2"))
			strValue=Utils.string("已支付");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据支付状态反格式化
	**/
	public void setPayStatus$(String strValue){
		if(Utils.empty(strValue)){
			this.payStatus=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"未支付"))
		 	this.payStatus=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"已支付"))
		 	this.payStatus=Utils.parseShort("2");
			
		
	 
	}
	
	/**
	* 支付状态 [非空]   1:未支付 2:已支付    
	**/
	public void setPayStatus(Short payStatus){
		this.payStatus = payStatus;
		
		this.setSeted(F.payStatus);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************修改时间**********************************/	
	/**
	* 修改时间 [非空]      
	**/
	public Date getUpdateTime(){
		
		if(this.updateTime!=null){
			return this.updateTime;
		}
		
		return this.updateTime;
	}
	/**
	* 获取修改时间格式化(toString)
	**/
	public String getUpdateTime$(){
		String strValue="";
	
	
	 	
		 strValue=Utils.string(Utils.date(this.getUpdateTime(),"yyyy-MM-dd HH:mm:ss"));
		
	 
	 	 return strValue;
	}
	/**
	* 根据修改时间反格式化
	**/
	public void setUpdateTime$(String strValue){
		if(Utils.empty(strValue)){
			this.updateTime=null;
			return;
		}
	
	
	 	this.updateTime=Utils.date(strValue,"yyyy-MM-dd HH:mm:ss");
	 
	}
	
	/**
	* 修改时间 [非空]      
	**/
	public void setUpdateTime(Date updateTime){
		this.updateTime = updateTime;
		
		this.setSeted(F.updateTime);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************添加时间**********************************/	
	/**
	* 添加时间 [非空]      
	**/
	public Date getAddTime(){
		
		if(this.addTime!=null){
			return this.addTime;
		}
		
		return this.addTime;
	}
	/**
	* 获取添加时间格式化(toString)
	**/
	public String getAddTime$(){
		String strValue="";
	
	
	 	
		 strValue=Utils.string(Utils.date(this.getAddTime(),"yyyy-MM-dd HH:mm:ss"));
		
	 
	 	 return strValue;
	}
	/**
	* 根据添加时间反格式化
	**/
	public void setAddTime$(String strValue){
		if(Utils.empty(strValue)){
			this.addTime=null;
			return;
		}
	
	
	 	this.addTime=Utils.date(strValue,"yyyy-MM-dd HH:mm:ss");
	 
	}
	
	/**
	* 添加时间 [非空]      
	**/
	public void setAddTime(Date addTime){
		this.addTime = addTime;
		
		this.setSeted(F.addTime);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	/*******************************状态**********************************/	
	/**
	* 状态 [非空]   1:正常 0:无效    
	**/
	public Short getStatus(){
		
		if(this.status!=null){
			return this.status;
		}
		
		return this.status;
	}
	/**
	* 获取状态格式化(toString)
	**/
	public String getStatus$(){
		String strValue="";
	
	
		
			
		 if(Utils.equals(Utils.string(this.getStatus()),"1"))
			strValue=Utils.string("正常");		 
			
		 if(Utils.equals(Utils.string(this.getStatus()),"0"))
			strValue=Utils.string("无效");		 
			
		
	 
	 	 return strValue;
	}
	/**
	* 根据状态反格式化
	**/
	public void setStatus$(String strValue){
		if(Utils.empty(strValue)){
			this.status=null;
			return;
		}
	
	
		
			
		 if(Utils.equals(strValue,"正常"))
		 	this.status=Utils.parseShort("1");
			
		 if(Utils.equals(strValue,"无效"))
		 	this.status=Utils.parseShort("0");
			
		
	 
	}
	
	/**
	* 状态 [非空]   1:正常 0:无效    
	**/
	public void setStatus(Short status){
		this.status = status;
		
		this.setSeted(F.status);
		
	}
	
	
	
	
	
	
	
	
	
	
 	
 	
	
	
	
	
	
 	
 	
 	
	
	
	
	/************LAZY3Q_DEFINE_CODE************/
	/************LAZY3Q_DEFINE_CODE************/	
	
	
	/**
	 * 触发器
	 */
	public static void on(Trigger.Index index,final Notify.Listener listener,Trigger.Type... types){
		Notify.on(AgentCardOrder.class, index, listener, types);
	}
	public static void on(final Notify.Listener listener,String type){
		Notify.on(AgentCardOrder.class, listener, type);
	}
	/**
	 * 当修改字段时
	 * @param filedName
	 * @param listener
	 */
	public static void on(String filedName,final Notify.Listener listener){
		Notify.on(AgentCardOrder.class, listener, filedName);
	}
	/**
	 * 当修改字段为某值时
	 * @param filedName
	 * @param value
	 * @param listener
	 */
	public static void on(String filedName,Object value,final Notify.Listener listener){
		if(value==null)return;
		Notify.on(AgentCardOrder.class, listener, filedName+"."+Utils.md5(""+value));
	}
	public void notify(String type){
		Trigger.on(AgentCardOrder.class,type, this);
	}
	
	
	/**
	 * 用来获取当有字段关联对象时的获取方式,调用如${AgentCardOrder.obj.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${AgentCardOrder.$filedName}获取关联对象
	 */
	public Map getObj(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return AgentCardOrder.class.getMethod("get$"+Utils.forMat(key.toString())).invoke(AgentCardOrder.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 用来获取某字段格式化的获取方式,调用如${AgentCardOrder.fmt.filedName}
	 * 因为有些变态的模板语言不能识别$，所以不能以${AgentCardOrder.filedName$}获取某字段格式化
	 */
	public Map getFmt(){
		return new HashMap(){
			@Override
			public Object get(Object key) {
				try {
					return AgentCardOrder.class.getMethod("get"+Utils.ForMat(key.toString()+"$")).invoke(AgentCardOrder.this);
				} catch (Exception e) {
					e.printStackTrace();
				}
				return null;
			}
		};
	}
	/**
	 * 获取查询参数链式串
	 * @return
	 */
	public static @Deprecated M where(){ return new M(0); }
	public static @Deprecated M m(){ return new M(0); }
	public static M where = new M(0,true);
	public static @database(DatabaseNames.distribute_sys) class M extends IbatisMap{
		int type = 0; 
		M linked = null;
		Boolean proxy = false;
		public M set = null;
		public M(int type){
			this.type = type;
			if(this.type==0){
				set = new M(1,true);
				set.linked = this;
			}
		};
		public M(int type,Boolean proxy){
			this.type = type;
			this.proxy=proxy;
		};
		public M proxy(){
			M m = new M(this.type);//当前的对像
			if(this.type==0){
				m.set = new M(1,true);//set对象
				m.set.linked = m;
			}else{
				m.linked=this.linked;
				this.linked.linked=m;
			}
			return m;
		}
		public @Deprecated M set(){			
			M m = this;
			m.linked=new M(1);
			m.linked.linked=m;
			return m.linked;
		};
		
		public M on(IbatisMap value,C column,String joinColumn){if(proxy)return proxy().on(value,column,joinColumn);this.put(value.getClass().getDeclaringClass().getSimpleName(), value);value.put("on", column.toString());value.put("to", joinColumn);return this;};
		
		
			
		
		/** 编号 [非空]       **/
		public M id(Object id){if(proxy)return proxy().id(id);  this.put("id", id);return this;};
	 	/** and id is null */
 		public M idNull(){if(proxy)return proxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
 		/** not .... */
 		public M idNot(){if(proxy)return proxy().idNot();this.put("idNot", "not");return this;};
 		public M idNotNull(){if(proxy)return proxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
 		public M idNot(Object id){if(proxy)return proxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
	 		
		/** and id <= ? */
		public M idMin(Object min){if(proxy)return proxy().idMin(min);this.put("idMin", min);return this;};
		/** and id >= ? */
		public M idMax(Object max){if(proxy)return proxy().idMax(max);this.put("idMax", max);return this;};
			
			
		public M idIn(String ids){
			if(proxy)return proxy().idIn(ids);  this.put("idIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 订单编号        **/
		public M orderNumber(Object orderNumber){if(proxy)return proxy().orderNumber(orderNumber);  this.put("orderNumber", orderNumber);return this;};
	 	/** and order_number is null */
 		public M orderNumberNull(){if(proxy)return proxy().orderNumberNull();if(this.get("orderNumberNot")==null)this.put("orderNumberNot", "");this.put("orderNumber", null);return this;};
 		/** not .... */
 		public M orderNumberNot(){if(proxy)return proxy().orderNumberNot();this.put("orderNumberNot", "not");return this;};
 		public M orderNumberNotNull(){if(proxy)return proxy().orderNumberNotNull();this.put("orderNumberNot", "not");this.put("orderNumber", null);return this;};
 		public M orderNumberNot(Object orderNumber){if(proxy)return proxy().orderNumberNot(orderNumber);this.put("orderNumberNot", "not");this.put("orderNumber", orderNumber);return this;};
	 		
			
		
			
	 	
			
		public M merchant$on(Merchant.M value){if(proxy)return proxy().merchant$on(value);this.put("Merchant", value);value.put("on", "merchant");return this;};
 				
 			
		
		/** 所属品牌 [非空] [Merchant]      **/
		public M merchant(Object merchant){if(proxy)return proxy().merchant(merchant);  this.put("merchant", merchant);return this;};
	 	/** and merchant is null */
 		public M merchantNull(){if(proxy)return proxy().merchantNull();if(this.get("merchantNot")==null)this.put("merchantNot", "");this.put("merchant", null);return this;};
 		/** not .... */
 		public M merchantNot(){if(proxy)return proxy().merchantNot();this.put("merchantNot", "not");return this;};
 		public M merchantNotNull(){if(proxy)return proxy().merchantNotNull();this.put("merchantNot", "not");this.put("merchant", null);return this;};
 		public M merchantNot(Object merchant){if(proxy)return proxy().merchantNot(merchant);this.put("merchantNot", "not");this.put("merchant", merchant);return this;};
	 		
			
		public M merchantIn(String ids){
			if(proxy)return proxy().merchantIn(ids);  this.put("merchantIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 用户编号        **/
		public M uid(Object uid){if(proxy)return proxy().uid(uid);  this.put("uid", uid);return this;};
	 	/** and uid is null */
 		public M uidNull(){if(proxy)return proxy().uidNull();if(this.get("uidNot")==null)this.put("uidNot", "");this.put("uid", null);return this;};
 		/** not .... */
 		public M uidNot(){if(proxy)return proxy().uidNot();this.put("uidNot", "not");return this;};
 		public M uidNotNull(){if(proxy)return proxy().uidNotNull();this.put("uidNot", "not");this.put("uid", null);return this;};
 		public M uidNot(Object uid){if(proxy)return proxy().uidNot(uid);this.put("uidNot", "not");this.put("uid", uid);return this;};
	 		
			
		
			
	 	
			
		
		/** 用户名称        **/
		public M nickName(Object nickName){if(proxy)return proxy().nickName(nickName);  this.put("nickName", nickName);return this;};
	 	/** and nick_name is null */
 		public M nickNameNull(){if(proxy)return proxy().nickNameNull();if(this.get("nickNameNot")==null)this.put("nickNameNot", "");this.put("nickName", null);return this;};
 		/** not .... */
 		public M nickNameNot(){if(proxy)return proxy().nickNameNot();this.put("nickNameNot", "not");return this;};
 		public M nickNameNotNull(){if(proxy)return proxy().nickNameNotNull();this.put("nickNameNot", "not");this.put("nickName", null);return this;};
 		public M nickNameNot(Object nickName){if(proxy)return proxy().nickNameNot(nickName);this.put("nickNameNot", "not");this.put("nickName", nickName);return this;};
	 		
			
		
			
	 	
			
		public M member$on(Member.M value){if(proxy)return proxy().member$on(value);this.put("Member", value);value.put("on", "member");return this;};
 				
 			
		
		/** 用户 [非空] [Member]      **/
		public M member(Object member){if(proxy)return proxy().member(member);  this.put("member", member);return this;};
	 	/** and member is null */
 		public M memberNull(){if(proxy)return proxy().memberNull();if(this.get("memberNot")==null)this.put("memberNot", "");this.put("member", null);return this;};
 		/** not .... */
 		public M memberNot(){if(proxy)return proxy().memberNot();this.put("memberNot", "not");return this;};
 		public M memberNotNull(){if(proxy)return proxy().memberNotNull();this.put("memberNot", "not");this.put("member", null);return this;};
 		public M memberNot(Object member){if(proxy)return proxy().memberNot(member);this.put("memberNot", "not");this.put("member", member);return this;};
	 		
			
		public M memberIn(String ids){
			if(proxy)return proxy().memberIn(ids);  this.put("memberIn", ids);return this;
		};	
 			
		
			
	 	
			
		public M agentCard$on(AgentConf.M value){if(proxy)return proxy().agentCard$on(value);this.put("AgentCard", value);value.put("on", "agent_card");return this;};
 				
 			
		
		/** 代理卡  [AgentConf]      **/
		public M agentCard(Object agentCard){if(proxy)return proxy().agentCard(agentCard);  this.put("agentCard", agentCard);return this;};
	 	/** and agent_card is null */
 		public M agentCardNull(){if(proxy)return proxy().agentCardNull();if(this.get("agentCardNot")==null)this.put("agentCardNot", "");this.put("agentCard", null);return this;};
 		/** not .... */
 		public M agentCardNot(){if(proxy)return proxy().agentCardNot();this.put("agentCardNot", "not");return this;};
 		public M agentCardNotNull(){if(proxy)return proxy().agentCardNotNull();this.put("agentCardNot", "not");this.put("agentCard", null);return this;};
 		public M agentCardNot(Object agentCard){if(proxy)return proxy().agentCardNot(agentCard);this.put("agentCardNot", "not");this.put("agentCard", agentCard);return this;};
	 		
			
		public M agentCardIn(String ids){
			if(proxy)return proxy().agentCardIn(ids);  this.put("agentCardIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** formId        **/
		public M formid(Object formid){if(proxy)return proxy().formid(formid);  this.put("formid", formid);return this;};
	 	/** and formid is null */
 		public M formidNull(){if(proxy)return proxy().formidNull();if(this.get("formidNot")==null)this.put("formidNot", "");this.put("formid", null);return this;};
 		/** not .... */
 		public M formidNot(){if(proxy)return proxy().formidNot();this.put("formidNot", "not");return this;};
 		public M formidNotNull(){if(proxy)return proxy().formidNotNull();this.put("formidNot", "not");this.put("formid", null);return this;};
 		public M formidNot(Object formid){if(proxy)return proxy().formidNot(formid);this.put("formidNot", "not");this.put("formid", formid);return this;};
	 		
			
		
			
	 	
			
		
		/** 支付金额 [非空]       **/
		public M payMoney(Object payMoney){if(proxy)return proxy().payMoney(payMoney);  this.put("payMoney", payMoney);return this;};
	 	/** and pay_money is null */
 		public M payMoneyNull(){if(proxy)return proxy().payMoneyNull();if(this.get("payMoneyNot")==null)this.put("payMoneyNot", "");this.put("payMoney", null);return this;};
 		/** not .... */
 		public M payMoneyNot(){if(proxy)return proxy().payMoneyNot();this.put("payMoneyNot", "not");return this;};
 		public M payMoneyNotNull(){if(proxy)return proxy().payMoneyNotNull();this.put("payMoneyNot", "not");this.put("payMoney", null);return this;};
 		public M payMoneyNot(Object payMoney){if(proxy)return proxy().payMoneyNot(payMoney);this.put("payMoneyNot", "not");this.put("payMoney", payMoney);return this;};
	 		
		/** and pay_money <= ? */
		public M payMoneyMin(Object min){if(proxy)return proxy().payMoneyMin(min);this.put("payMoneyMin", min);return this;};
		/** and pay_money >= ? */
		public M payMoneyMax(Object max){if(proxy)return proxy().payMoneyMax(max);this.put("payMoneyMax", max);return this;};
			
			
		
			
	 	
			
		
		/** 支付时间 [非空]       **/
		public M payTime(Object payTime){if(proxy)return proxy().payTime(payTime);  this.put("payTime", payTime);return this;};
	 	/** and pay_time is null */
 		public M payTimeNull(){if(proxy)return proxy().payTimeNull();if(this.get("payTimeNot")==null)this.put("payTimeNot", "");this.put("payTime", null);return this;};
 		/** not .... */
 		public M payTimeNot(){if(proxy)return proxy().payTimeNot();this.put("payTimeNot", "not");return this;};
 		public M payTimeNotNull(){if(proxy)return proxy().payTimeNotNull();this.put("payTimeNot", "not");this.put("payTime", null);return this;};
 		public M payTimeNot(Object payTime){if(proxy)return proxy().payTimeNot(payTime);this.put("payTimeNot", "not");this.put("payTime", payTime);return this;};
	 		
 		/** and pay_time >= ? */
 		public M payTimeStart(Object start){if(proxy)return proxy().payTimeStart(start);this.put("payTimeStart", start);return this;};			
 		/** and pay_time <= ? */
 		public M payTimeEnd(Object end){if(proxy)return proxy().payTimeEnd(end);this.put("payTimeEnd", end);return this;};
			
			
		
			
	 	
			
		
		/** 支付状态 [非空]   1:未支付 2:已支付     **/
		public M payStatus(Object payStatus){if(proxy)return proxy().payStatus(payStatus);  this.put("payStatus", payStatus);return this;};
	 	/** and pay_status is null */
 		public M payStatusNull(){if(proxy)return proxy().payStatusNull();if(this.get("payStatusNot")==null)this.put("payStatusNot", "");this.put("payStatus", null);return this;};
 		/** not .... */
 		public M payStatusNot(){if(proxy)return proxy().payStatusNot();this.put("payStatusNot", "not");return this;};
 		public M payStatusNotNull(){if(proxy)return proxy().payStatusNotNull();this.put("payStatusNot", "not");this.put("payStatus", null);return this;};
 		public M payStatusNot(Object payStatus){if(proxy)return proxy().payStatusNot(payStatus);this.put("payStatusNot", "not");this.put("payStatus", payStatus);return this;};
	 		
			
		public M payStatusIn(String ids){
			if(proxy)return proxy().payStatusIn(ids);  this.put("payStatusIn", ids);return this;
		};	
 			
		
			
	 	
			
		
		/** 修改时间 [非空]       **/
		public M updateTime(Object updateTime){if(proxy)return proxy().updateTime(updateTime);  this.put("updateTime", updateTime);return this;};
	 	/** and update_time is null */
 		public M updateTimeNull(){if(proxy)return proxy().updateTimeNull();if(this.get("updateTimeNot")==null)this.put("updateTimeNot", "");this.put("updateTime", null);return this;};
 		/** not .... */
 		public M updateTimeNot(){if(proxy)return proxy().updateTimeNot();this.put("updateTimeNot", "not");return this;};
 		public M updateTimeNotNull(){if(proxy)return proxy().updateTimeNotNull();this.put("updateTimeNot", "not");this.put("updateTime", null);return this;};
 		public M updateTimeNot(Object updateTime){if(proxy)return proxy().updateTimeNot(updateTime);this.put("updateTimeNot", "not");this.put("updateTime", updateTime);return this;};
	 		
 		/** and update_time >= ? */
 		public M updateTimeStart(Object start){if(proxy)return proxy().updateTimeStart(start);this.put("updateTimeStart", start);return this;};			
 		/** and update_time <= ? */
 		public M updateTimeEnd(Object end){if(proxy)return proxy().updateTimeEnd(end);this.put("updateTimeEnd", end);return this;};
			
			
		
			
	 	
			
		
		/** 添加时间 [非空]       **/
		public M addTime(Object addTime){if(proxy)return proxy().addTime(addTime);  this.put("addTime", addTime);return this;};
	 	/** and add_time is null */
 		public M addTimeNull(){if(proxy)return proxy().addTimeNull();if(this.get("addTimeNot")==null)this.put("addTimeNot", "");this.put("addTime", null);return this;};
 		/** not .... */
 		public M addTimeNot(){if(proxy)return proxy().addTimeNot();this.put("addTimeNot", "not");return this;};
 		public M addTimeNotNull(){if(proxy)return proxy().addTimeNotNull();this.put("addTimeNot", "not");this.put("addTime", null);return this;};
 		public M addTimeNot(Object addTime){if(proxy)return proxy().addTimeNot(addTime);this.put("addTimeNot", "not");this.put("addTime", addTime);return this;};
	 		
 		/** and add_time >= ? */
 		public M addTimeStart(Object start){if(proxy)return proxy().addTimeStart(start);this.put("addTimeStart", start);return this;};			
 		/** and add_time <= ? */
 		public M addTimeEnd(Object end){if(proxy)return proxy().addTimeEnd(end);this.put("addTimeEnd", end);return this;};
			
			
		
			
	 	
			
		
		/** 状态 [非空]   1:正常 0:无效     **/
		public M status(Object status){if(proxy)return proxy().status(status);  this.put("status", status);return this;};
	 	/** and status is null */
 		public M statusNull(){if(proxy)return proxy().statusNull();if(this.get("statusNot")==null)this.put("statusNot", "");this.put("status", null);return this;};
 		/** not .... */
 		public M statusNot(){if(proxy)return proxy().statusNot();this.put("statusNot", "not");return this;};
 		public M statusNotNull(){if(proxy)return proxy().statusNotNull();this.put("statusNot", "not");this.put("status", null);return this;};
 		public M statusNot(Object status){if(proxy)return proxy().statusNot(status);this.put("statusNot", "not");this.put("status", status);return this;};
	 		
			
		public M statusIn(String ids){
			if(proxy)return proxy().statusIn(ids);  this.put("statusIn", ids);return this;
		};	
 			
		
			
	 	
	 	public M add(String key, Object value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	 	public M add(F key, Object value) {if(proxy)return proxy().add(key,value);this.put(key.toString(), value);return this;}
	 	
	 	public M desc(C key) {if(proxy)return proxy().desc(key);this.put("desc", key.column);return this;}
	 	public M asc(C key) {if(proxy)return proxy().asc(key);this.put("asc", key.column);return this;}
	 	public M desc(String sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	 	public M asc(String sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	 	public M definex(String sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	 	
	 	/** 获取所有代理卡订单 **/
		public @api List<AgentCardOrder> list(Integer size){			
			return getAgentCardOrderList(this,size);
		}
		/** 获取代理卡订单分页 **/
		public @api Page<AgentCardOrder> page(Integer page,Integer size){			
			return getAgentCardOrderPage(page, size , this);
		}
		/** 根据查询条件取代理卡订单 **/
		public @api AgentCardOrder get(){			
			return getAgentCardOrder(this);
		}
		/** 获取代理卡订单数 **/
		public @api Long count(){			
			return getAgentCardOrderCount(this);
		}
		/** 获取代理卡订单表达式 **/
		public @api <T> T eval(String strEval){			
			return getAgentCardOrderEval(strEval,this);
		}
		
		/** 获取代理卡订单统计 **/
		public @api List<Map> stats(C sumKey,C groupKey,int dateType){			
			return getAgentCardOrderStats(this,sumKey,groupKey,dateType);
		}
		/** 获取代理卡订单统计 **/
		public @api List<Map> stats(C sumKey,C groupKey){			
			return getAgentCardOrderStats(this,sumKey,groupKey,-1);
		}
		
		/** 根据条件更新 **/
		public @api int update(){			
			M where = null;
			M set = null;
			if(this.type==0){
				if(this.linked==null)throw new RuntimeException("未发set");
				where = this;
				set = this.linked;
			}else{
				if(this.linked==null)throw new RuntimeException("未发where条件");
				set = this;
				where = this.linked;
			}
			return updateAgentCardOrder(set,where);
		}
		/** 根据条件删除 **/
		public @api void delete(){			
			deleteAgentCardOrder(this);
		}
	}
	
	public static class Param extends M{
		public Param(int type) {
			super(type);
		}
		public Param(int type, Boolean proxy) {
			super(type, proxy);
		}
	}
	
	/** 对象的字段描述 **/
	public static class F{
		
			
		/** 编号 [非空]       **/
		public final static @type(Long.class)  String id="id";
	 			
			
	 	
			
		/** 订单编号        **/
		public final static @type(String.class)  String orderNumber="orderNumber";
	 			
			
	 	
			
		/** 所属品牌 [非空] [Merchant]      **/
		public final static @type(Long.class)  String merchant="merchant";
	 			
			
	 	
			
		/** 用户编号        **/
		public final static @type(String.class) @like String uid="uid";
	 			
			
	 	
			
		/** 用户名称        **/
		public final static @type(String.class) @like String nickName="nickName";
	 			
			
	 	
			
		/** 用户 [非空] [Member]      **/
		public final static @type(Long.class)  String member="member";
	 			
			
	 	
			
		/** 代理卡  [AgentConf]      **/
		public final static @type(Long.class)  String agentCard="agentCard";
	 			
			
	 	
			
		/** formId        **/
		public final static @type(String.class)  String formid="formid";
	 			
			
	 	
			
		/** 支付金额 [非空]       **/
		public final static @type(Double.class)  String payMoney="payMoney";
	 			
		/** and pay_money >= ? */
		public final static @type(Double.class) String payMoneyMin="payMoneyMin";
		/** and pay_money <= ? */
		public final static @type(Double.class) String payMoneyMax="payMoneyMax";
				
			
	 	
			
		/** 支付时间 [非空]       **/
		public final static @type(Date.class)  String payTime="payTime";
	 			
	 	/** and pay_time >= ? */
 		public final static @type(Date.class) String payTimeStart="payTimeStart";
 		/** and pay_time <= ? */
 		public final static @type(Date.class) String payTimeEnd="payTimeEnd";
				
			
	 	
			
		/** 支付状态 [非空]   1:未支付 2:已支付     **/
		public final static @type(Short.class)  String payStatus="payStatus";
	 			
			
	 	
			
		/** 修改时间 [非空]       **/
		public final static @type(Date.class)  String updateTime="updateTime";
	 			
	 	/** and update_time >= ? */
 		public final static @type(Date.class) String updateTimeStart="updateTimeStart";
 		/** and update_time <= ? */
 		public final static @type(Date.class) String updateTimeEnd="updateTimeEnd";
				
			
	 	
			
		/** 添加时间 [非空]       **/
		public final static @type(Date.class)  String addTime="addTime";
	 			
	 	/** and add_time >= ? */
 		public final static @type(Date.class) String addTimeStart="addTimeStart";
 		/** and add_time <= ? */
 		public final static @type(Date.class) String addTimeEnd="addTimeEnd";
				
			
	 	
			
		/** 状态 [非空]   1:正常 0:无效     **/
		public final static @type(Short.class)  String status="status";
	 			
			
	 	
	 	public static String get(String name){
			try {
				Field field = F.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	/** 对象的数据库字段描述 **/
	public static enum C{
		
		id("id"),
		orderNumber("order_number"),
		merchant("merchant"),
		uid("uid"),
		nickName("nick_name"),
		member("member"),
		agentCard("agent_card"),
		formid("formid"),
		payMoney("pay_money"),
		payTime("pay_time"),
		payStatus("pay_status"),
		updateTime("update_time"),
		addTime("add_time"),
		status("status"),
		count("count");
		String column;
		C(String column){
			this.column = column;
		}
		public String toString(){
			return this.column;
		}
		public static String get(String name){
			try {
				Field field = C.class.getField(name);
				if(field!=null)
					return field.get(null).toString();
			} catch (Exception e) {
				//e.printStackTrace();
			}
			return null;
		}
	}
	
	
	
	
	/**
	* 获取代理卡订单数据
	**/
	public static Object getData(Object param){
		if(param==null)
			return null;
		Object value = null;
		if(param.getClass()==Long.class)
			value = AgentCardOrder.get((Long)param);
		else if(param instanceof java.util.Map){
			java.util.Map params = (Map) param;
			if(params.get("size")==null)
				value = AgentCardOrder.getAgentCardOrder(params);
			else
				value = AgentCardOrder.getAgentCardOrderList(params, (Integer) params.get("size"));
		}else if(param.getClass()==Long.class )
			value =  AgentCardOrder.where().id(param).get();
		else if(!Utils.empty(param.toString()))
			value = AgentCardOrder.get(Long.valueOf(param.toString()));
		return value;
	}
	
	/**对象转json**/
	public Map toJSON(){
		return toJSON(false);
	}
	public Map toJSON(boolean simple){
		return toJSON(simple,0);
	}
	public Map toJSON(boolean simple,int step){
		Map map = new HashMap();
		map.put("id",this.getId());
	
		Utils.fms(map,simple?"":"id",this.getId(),this.getId$());
		
			
 		
	
		Utils.fms(map,simple?"number":"orderNumber",this.getOrderNumber(),this.getOrderNumber$());
		
			
 		
	
		Utils.fms(map,simple?"":"merchant",this.getMerchant(),this.getMerchant$());
		
			
 		
	
		Utils.fms(map,simple?"":"uid",this.getUid(),this.getUid$());
		
			
 		
	
		Utils.fms(map,simple?"name":"nickName",this.getNickName(),this.getNickName$());
		
			
 		
	
		Utils.fms(map,simple?"":"member",this.getMember(),this.getMember$());
		
			
 		
	
		Utils.fms(map,simple?"card":"agentCard",this.getAgentCard(),this.getAgentCard$());
		
			
 		
	
		Utils.fms(map,simple?"":"formid",this.getFormid(),this.getFormid$());
		
			
 		
	
		Utils.fms(map,simple?"money":"payMoney",this.getPayMoney(),this.getPayMoney$());
		
			
 		
	
		Utils.fms(map,simple?"time":"payTime",this.getPayTime(),this.getPayTime$());
		
			
 		
	
		Utils.fms(map,simple?"status":"payStatus",this.getPayStatus(),this.getPayStatus$());
		
			
 		
	
		Utils.fms(map,simple?"time":"updateTime",this.getUpdateTime(),this.getUpdateTime$());
		
			
 		
	
		Utils.fms(map,simple?"time":"addTime",this.getAddTime(),this.getAddTime$());
		
			
 		
	
		Utils.fms(map,simple?"":"status",this.getStatus(),this.getStatus$());
		
			
 		
	
		if(this.suffix!=null)map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOJSON************/
		/************LAZY3Q_DEFINE_TOJSON************/
		return map;
	}
	/**对象转map**/
	public Map toMap(){
		Map map = new HashMap();
	
		map.put("id",this.getId());
 		
	
		map.put("orderNumber",this.getOrderNumber());
 		
	
		map.put("merchant",this.getMerchant());
 		
	
		map.put("uid",this.getUid());
 		
	
		map.put("nickName",this.getNickName());
 		
	
		map.put("member",this.getMember());
 		
	
		map.put("agentCard",this.getAgentCard());
 		
	
		map.put("formid",this.getFormid());
 		
	
		map.put("payMoney",this.getPayMoney());
 		
	
		map.put("payTime",this.getPayTime());
 		
	
		map.put("payStatus",this.getPayStatus());
 		
	
		map.put("updateTime",this.getUpdateTime());
 		
	
		map.put("addTime",this.getAddTime());
 		
	
		map.put("status",this.getStatus());
 		
	
		map.put("suffix", this.suffix);
		
		/************LAZY3Q_DEFINE_TOMAP************/
		/************LAZY3Q_DEFINE_TOMAP************/
		return map;
	}
	/**map转对象**/
	public static AgentCardOrder fromMap(Map map){
		AgentCardOrder agentCardOrder = new AgentCardOrder();
	
		agentCardOrder.id = Utils.parseLong(map.get("id"));
 		
	
		agentCardOrder.orderNumber = Utils.parseString(map.get("orderNumber"));
 		
	
		agentCardOrder.merchant = Utils.parseLong(map.get("merchant"));
 		
	
		agentCardOrder.uid = Utils.parseString(map.get("uid"));
 		
	
	
		agentCardOrder.member = Utils.parseLong(map.get("member"));
 		
	
		agentCardOrder.agentCard = Utils.parseLong(map.get("agentCard"));
 		
	
		agentCardOrder.formid = Utils.parseString(map.get("formid"));
 		
	
		agentCardOrder.payMoney = Utils.parseDouble(map.get("payMoney"));
 		
	
		agentCardOrder.payTime = Utils.parseDate(map.get("payTime"));
 		
	
		agentCardOrder.payStatus = Utils.parseShort(map.get("payStatus"));
 		
	
		agentCardOrder.updateTime = Utils.parseDate(map.get("updateTime"));
 		
	
		agentCardOrder.addTime = Utils.parseDate(map.get("addTime"));
 		
	
		agentCardOrder.status = Utils.parseShort(map.get("status"));
 		
	
		return agentCardOrder;
	}
	
	
	/**字段设置标记队列**/
	private Map<String,Boolean> seted=new HashMap();
	public Boolean getSeted(String key){
		return seted.get(key);
	}
	public void setSeted(String key){
		seted.put(key,true);
	}
	/**同步未set的字段**/
	public void mergeSet(AgentCardOrder old){
		Field[] fields = this.getClass().getDeclaredFields();
		try {
			for(Field field:fields){
				String key = field.getName();
				if(seted.get(key)==null && field.getAnnotation(column.class)!=null){
					field.setAccessible(true);
					field.set(this, field.get(old));					
				}
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
		
	/**自定义变量存储**/
	private Map values=new HashMap();
	public Map getValues(){
		return values;
	}
	public void setValues(String name,Object value){
		values.put(name,value);
	}
	
	/**分表时的表名后缀**/
	private String suffix;
	public String getSuffix() {
		return suffix;
	}
	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}
	
	
	/**获取数据库名称**/
	public static String getDataBaseName(){
		return Utils.config("spring.datasource.distribute_sys.name");
	}
	
	
	public static String getIcon(){
		return "/images/icons/20088256421631277809.png";
	}
	public static String getIconfont(){
		return "icon-liebiao1";
	}
	public static enum ACT{
		列表,添加,修改,详情
	};
	public static String getUrl(ACT act,AgentCardOrder.M params){
		if(params==null)params=new AgentCardOrder.M(0);
		params.remove("joins");
		params.remove("definexs");
		params.remove("distinct");
		String strUrl = "/admin/agents/agencycardorder.edit.html?";
		if(params.get("id")!=null){
			strUrl+="&id="+Utils.encode(""+params.get("id"),Utils.UTF8);
		}
		if(act==ACT.列表){
			strUrl = "/admin/agents/agencycardorder.html?1=1";
		
		}else if(act==ACT.添加){
			strUrl+="&edittype=insert";
		
		
		}else if(act==ACT.修改){
			strUrl+="&edittype=update";
		
		}else if(act==ACT.详情){
			strUrl+="&edittype=detail";
		
		}		
		if(params!=null){
			for(Object key:params.keySet()){
				strUrl+="&"+key+"="+Utils.encode(""+params.get(key),Utils.UTF8)+"";
			}
		}
		return strUrl;
	}
	public String getDetailUrl(){
		return this.getUrl(ACT.详情, where.id(this.getId()));
	}
	
	/**
	* 转跳到当前地址
	**/
	public static Protocol redirect(AgentCardOrder.ACT act,AgentCardOrder.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_REDIRECT");
		protocol.set("url",AgentCardOrder.getUrl(act, params));
		return protocol;
	}
	/**
	* 打开一个新的tab页面
	**/
	public static Protocol href(AgentCardOrder.ACT act,AgentCardOrder.M params){
		Protocol protocol = Protocol.create(true,null,"ACT_HREF");
		protocol.set("url",AgentCardOrder.getUrl(act, params));
		protocol.set("title",act.name());
		return protocol;
	}
	/**
	* 显示一个消息框，并且关闭当前的对话框
	**/
	public static Protocol message(String message){
		Protocol protocol = Protocol.create(true,null,"ACT_MESSAGE");
		protocol.set("message",message);
		return protocol;
	}
	
	
	static com.distribute.framework.dao.IAgentCardOrderDao getAgentCardOrderDao(){
		return Utils.getBean("agentCardOrderDao");
	};
	
}